package cn.edu.dgut.sai;

/**
 * Hello world!
 *
 * lamda 不会在编译生成匿名内部类的实例， 但是 在rumtime的时候会生成实例
 */

public class App 
{
    public static void main( String[] args )
    {
        System.out.println( "Hello World!" );
        System.out.println( new TalkIsCheap().show());
        showMeCode showMeCodeByL = ()->"lamda";
        showMeCode showMeCodeByS = App::showYouByS;
        System.out.println(showMeCodeByS.show());
        showMeCode showMeCodeByP = new App()::showYouByP;
        System.out.println(showMeCodeByS.show());

    }
    private String showYouByP()
    {
        return "私有方法参考";
    }

    static String showYouByS()
    {
        return "私有方法参考";
    }
    static class TalkIsCheap implements showMeCode{

        @Override
        public String show() {
            return "be Better";
        }
    }
}
@FunctionalInterface
interface showMeCode{
    String show();
}